import axios from 'axios';

export default {
    install: function(Vue, options) {

        let service = {
            // 查询未审核通过的支付单
            GetUnauditedPayments: (pageIndex, pageSize) => {
                return axios.get('/admin/payment/unaudited', {
                    params: {
                        pageIndex: pageIndex,
                        pageSize: pageSize
                    }
                });
            },

            // 查询未审核支付单数量
            GetUnauditedPaymentsCount: () => {
                return axios.get('/admin/payment/unaudited/count');
            },

            // 查询支付单
            QueryPayments: (condition, pageIndex, pageSize) => {
                return axios.post(`/admin/payment/query?pageIndex=${pageIndex}&pageSize=${pageSize}`, condition);
            },

            // 查询支付单数量
            QueryPaymentsCount: (condition) => {
                return axios.post('/admin/payment/query/count', condition);
            },

            // 支付单审核
            Audit: (payment) => {
                return axios.put('/admin/payment/audit', payment);
            },

            // 删除支付单
            Drop: (payment) => {
                return axios.delete(`/admin/payment/remove/${payment.PayId}`);
            }
        }

        Vue.prototype.$PaymentService = service;
    }
}